﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Footer.ascx.cs" Inherits="UserControls_Footer" %>

<div class="FooterContainer">
    <div class="DocumentContainer" style="padding-top:20px;">
        <div class="FooterLinksContainer">            
            <asp:Literal ID="ltrLinks" runat="server"></asp:Literal>                        
            <div class="FooterLinkBox">
                <div class="FooterCategoryHeading">Quick Links</div>
                <a href="/Default.aspx">Home</a><br />
                <a href="/Pages/Public/ShowContent.aspx?ID=<%=ConfigReader.ContentIDOfAboutUs %>">About Us</a><br />
                <a href="/Pages/Public/ShowContent.aspx?ID=<%=ConfigReader.ContentIDOfOurServices %>">Services</a><br />
                <a href="/Pages/Public/ShowContent.aspx?ID=<%=ConfigReader.ContentIDOfPrivacyPolicy %>">Privacy Policy</a><br />
                <a href="/Pages/Public/ShowContent.aspx?ID=<%=ConfigReader.ContentIDOfFAQ %>">FAQ</a><br />
                <a href="/Pages/Public/Testimonials.aspx">Testimonials</a><br />
                <a href="/Pages/Public/MediaReports.aspx">Media Reports</a><br />
            </div>
            <div class="FooterLinkBox">
                <div class="FooterCategoryHeading">Useful Links</div>
                <a href="/Pages/Public/Login.aspx">Login</a><br />
                <a href="/Pages/Public/Registration.aspx">Register</a><br />
                <%--Subscribe<br />--%>
                <%--<a href="/Pages/Public/ContactUs.aspx">Write to Us</a><br />--%>

                <%--<div class="SocialButtons">
                    <div class="FaceBook"></div>
                    <div class="Twitter"></div>
                    <div class="MySpace"></div>
                    <div class="clearboth"></div>
                </div>--%>
            </div>
            <div class="clearboth"></div>
        </div>

        <div style="margin-top:20px;"> 
            <%--Sign Up Box Start--%>                   
            <div class="SignUpBox">
                <div style="width:100%; padding:15px 0px 15px 0px;">
                    <div class="floatleft" style="margin-left:40px; margin-top:15px;"><h3>Register with us</h3></div>
                    <div class="floatright" style="margin-right:40px;"><div class="SignUpButton" onclick="RedirectToSignUp();"></div></div>
                    <div class="clearboth"></div>
                </div>
            </div>
            <%--News Letter Box Start--%>                    
            <div class="NewsLetterBox">
                <div style="width:100%; padding:15px 0px 15px 0px;">
                    <div class="floatleft" style="margin-left:40px; margin-top:15px;"><h3>Newsletter</h3></div>
                    <div class="floatleft" style="margin-left:20px; margin-right:10px;">
                        <asp:TextBox ID="txtNewsletter" CssClass="NewsLetterTextBox" runat="server" Text="Enter email"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfvEmail" runat="server"
                            Display="Dynamic" SetFocusOnError="true"
                            ControlToValidate="txtNewsletter" ValidationGroup="Newsletter"
                            ErrorMessage="*">
                        </asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                            ControlToValidate="txtNewsletter" Display="Dynamic" SetFocusOnError="true"
                            ErrorMessage="*"
                            ValidationGroup="Newsletter">
                        </asp:RegularExpressionValidator>
                    </div>
                    <div class="floatright" style="margin-right:40px;"><div class="NewsLetterButton" onclick="SubscribeToNewsLetter();"></div></div>
                    <div class="clearboth"></div>
                </div>
            </div>
            <div class="clearboth"></div>                    
        </div>
    </div>
</div>


<%--Subscribe to Newsletter Modal Popup Section Start --%>
<div id="divSubscribeNewsLetter" class="PopupContainer" style="display: none; width:500px; height:auto;">        
    <div class="PopupHeaderMiddle">Subscribe to Newsletter</div> 
    <div class="PopupBody" style="padding:5px; height:50px;">
        <div id="divSubscribeToNewsletterMessage" class="MessageBox" style="display:none;">You have successfully subscribed to our Newsletter service.</div>
        <div id="divSubscriberAlreadyExists" class="ErrorMessageBox" style="display:none;">You have already subscribed to our Newsletter service.</div>
        <img id="imgSubscribeToNewsletterLoading" src="/Images/Loading.gif" alt="" title="" />            
    </div>
    <div class="PopupButtonContainer">             
        <input type="button" value="Close" class="ButtonCommon" onclick="HideModalPopup();" />            
    </div>
</div>
<%--Subscribe to Newsletter Modal Popup Section End--%>

<script language="javascript" type="text/javascript">
    function SubscribeToNewsLetter() {
        //var parameters = "{'sDate':'" + sDate + "','eDate':'" + eDate + "'}"        
        if (Page_ClientValidate('Newsletter')) {
            $('#imgSubscribeToNewsletterLoading').show();
            $('#divSubscriberAlreadyExists').hide();
            $('#divSubscribeToNewsletterMessage').hide();
            var email = $('#<%=txtNewsletter.ClientID %>').val();
            ShowModalPopup('divSubscribeNewsLetter', '', '', true);            
            //var parameters = JSON.stringify(email);             
            $.ajax({
                type: "POST",
                url: "/Services/AjaxService.asmx/SubscribeNewsLetter",
                data: '{"email": "' + email + '"}',
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: OnSubscriptionComplete,
                failure: OnSubscriptionFailure
            });
        }
    }
    function OnSubscriptionFailure(msg) {
        alert(msg);
    }
    function OnSubscriptionComplete(result) {
        var status = (typeof result.d) == 'string' ? eval('(' + result.d + ')') : result.d;
        if (status == 1) {
            $('#imgSubscribeToNewsletterLoading').hide();
            $('#divSubscriberAlreadyExists').hide();
            $('#divSubscribeToNewsletterMessage').show();
            $('#<%=txtNewsletter.ClientID %>').val('');
        }
        else {
            $('#imgSubscribeToNewsletterLoading').hide();
            $('#divSubscriberAlreadyExists').show();
        }
    }
    function RedirectToSignUp() {
        window.location = '/Pages/Public/Registration.aspx?Rnd=' + GetRandomNumber();
    }
    $(document).ready(function () {
        $('#<%=txtNewsletter.ClientID %>').blur(function () {
            if ($(this).val().length == 0)
                $(this).removeClass('NewsLetterTextBoxEnter').val('Enter email');
        });
        $('#<%=txtNewsletter.ClientID %>').focus(function () {
            $(this).addClass('NewsLetterTextBoxEnter');
            if ($(this).val() == 'Enter email')
                $(this).val('');
        });
        $('#<%=txtNewsletter.ClientID %>').keypress(function (event) {
            if (event.which == '13') {
                event.preventDefault();
                SubscribeToNewsLetter();
            }
        });
    });    

</script>